class Program
{
    static void Main(string[] args)
    {
        const string IGNORE_FILE_PATH = ".peekignore";
        var scanner = new SensitiveInfoScanner();
        var fileScanner = new FileScanner(ignoreFilePath: IGNORE_FILE_PATH);
        var reportGenerator = new Result.ReportGenerator();
        var customRuleLoader = new CustomRuleLoader();
        var gitIntegration = new GitIntegration();
        var encodingDetector = new FileEncodingDetector();

        // 示例：扫描当前目录下的所有 .cs 文件
        var files = fileScanner.GetFiles(".", new[] { ".cs" });
        var results = new List<Result.ScanResult>();

        foreach (var file in files)
        {
            var content = encodingDetector.ReadFileWithEncoding(file);
            if (content != null)
            {
                results.AddRange(scanner.ScanFile(file).Select(match => new Result.ScanResult
                {
                    FileName = file,
                    LineNumber = match.LineNumber,
                    Match = match.Match
                }));
            }
        }

        // 生成报告
        reportGenerator.GenerateReport(results, "json", "report.json");

        Console.WriteLine("扫描完成，报告已生成。");
    }
}